package com.study.shop.controller.product;

import com.study.shop.entity.po.Category;
import com.study.shop.entity.common.R;
import com.study.shop.service.CategoryService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/admin/product")
@RequiredArgsConstructor
public class CategoryController {
    private final CategoryService categoryService;

    // 根据当前分类id查询下级分类
    @GetMapping("/nextLevelCategory/{id}")
    public R<List<Category>> nextLevelCategory(@PathVariable("id") int id) {
        List<Category> list =categoryService.nextLevelCategory(id);
        return R.success(list);
    }
}
